package com.huang.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@Controller
public class ModelTest {
    @RequestMapping("/T/t1")
    public String ModelTest01(HttpServletRequest request, HttpServletResponse response){
        HttpSession session = request.getSession();
        System.out.println(session.getId());
        return "hello";
    }
    @RequestMapping("/T/t2")
    public String ModelTest02(Model model){
        model.addAttribute("msg","NO LLLOG");
        //redirect重定向（无法访问WEB-INF下目录可以访问index.jsp）
        //可用forward转发访问
        return "forward:/WEB-INF/jsp/hello.jsp";
    }
}
